package cn.gqr.service.Impl;

import cn.gqr.entity.User;
import cn.gqr.mapper.PublicMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;

@Primary
@Service
public class UserDetailsServiceImpl implements UserDetailsService {

    @Autowired
    PublicMapper publicMapper;

    @Override
    public UserDetails loadUserByUsername(String s) throws UsernameNotFoundException {
        //访问dao层
        // s 就是浏览器给我们的的登录账号
        User u = publicMapper.findUserByAccount(s);
        return u;
    }


}
